package com.niiwoo.civet.account.service.local.openAccount2.order;

import com.niiwoo.civet.account.dao.entity.OpenAccountRecord;
import com.niiwoo.civet.account.enums.OpenAccountRecordStatusEnum;
import com.niiwoo.civet.account.service.local.openAccount2.dto.CreateRequest;
import com.niiwoo.civet.account.service.local.openAccount2.dto.OrderBasicInfo;
import com.niiwoo.civet.account.service.local.openAccount2.dto.UpdateRequest;
import com.niiwoo.civet.account.service.local.openAccount2.type.OpenAccountTypeable;

public interface OpenAccountOrderOperation<T> extends OpenAccountTypeable<T> {

    /**
     * 根据流水号获取订单
     *
     * @param requestNo 流水号
     */
    T getByRequestNo(String requestNo);

    /**
     * 保存订单
     *
     * @param order 订单
     */
    boolean create(T order);

    /**
     * 更新订单
     *
     * @param order 订单
     */
    boolean update(T order);

    /**
     * 订单是否已成功
     */
    boolean isSuccess(T order);

    /**
     * 新建订单对象
     *
     * @param request 开户请求
     * @param record 开户记录
     */
    T getNewOrder(CreateRequest request, OpenAccountRecord record);

    /**
     * 获取订单基础信息
     *
     * @param t 订单
     */
    OrderBasicInfo getOrderBasicInfo(T t);


    /**
     * 新建更新的订单对象
     * @param oldOrder 老订单
     * @param request 更新请求
     * @param recordStatus 开户记录状态
     * @return
     */
    T getUpdateOrder(T oldOrder, UpdateRequest request, OpenAccountRecordStatusEnum recordStatus);
}
